home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PASCALL / CLOCKIN / CLOCK5.PAS < prev    next >
Pascal/Delphi Source File  |  1992-12-25  |  2KB  |  71 lines

  1. program graphclock;
  2. uses
  3.      graph,graphin1,dos,crt;
  4. var
  5.      beeper,stop:boolean;
  6. const
  7.      lasthour:word=hrhandsize;
  8.      lastminute:word=minhandsize;
  9.      lastsecond:word=sechandsize;
  10.      lasthundrethofasecond:word=hndthsechandsize;
  11. var
  12.      hour,minute,second,hundrethofasecond:word;
  13.  
  14.  
  15. procedure putoutclock;
  16. const
  17.      lasthour:word=hrhandsize;
  18.      lastminute:word=minhandsize;
  19.      lastsecond:word=sechandsize;
  20.      lasthundrethofasecond:word=hndthsechandsize;
  21. var
  22.      hour,minute,second,hundrethofasecond:word;
  23. begin
  24.      repeat
  25.           gettime(hour,minute,second,hundrethofasecond);
  26.           if not(lasthour=hour) then begin
  27.                puthand(lasthour,hour,hr);
  28.                lasthour:=hour;
  29.           end;
  30.           if not(lastminute=minute) then begin
  31.                puthand(lastminute,minute,min);
  32.                lastminute:=minute;
  33.           end;
  34.           if not(lastsecond=second) then begin
  35.                puthand(lastsecond,second,sec);
  36.                if beeper then beep;
  37.                lastsecond:=second;
  38.           end;
  39.           if not(lasthundrethofasecond=hundrethofasecond) then begin
  40.                puthand(lasthundrethofasecond,hundrethofasecond,hndthsec);
  41.                lasthundrethofasecond:=hundrethofasecond;
  42.           end;
  43.      until keypressed;
  44. end;
  45.  
  46. procedure done;
  47. begin
  48.      restorecrtmode;
  49.      closegraph;
  50.      halt;
  51. end;
  52.  
  53. procedure doit;
  54. begin
  55.           putoutclock;
  56.           case upcase(readkey) of
  57.                'S':beeper:=not(beeper);
  58.                chr(27):done;
  59.           end;
  60.           doit;
  61. end;
  62.  
  63. begin
  64.      beeper:=true;
  65.      setupgraph;
  66.      setupgrid;
  67.      centerx:=319;
  68.      centerc:=319;
  69.      doit;
  70.      done;
  71. end.